package com.ergou.easylive.admin.controller.system;

import com.ergou.easylive.admin.convert.SysUserRegisterDTOConverter;
import com.ergou.easylive.admin.entity.bo.SysUserRegisterBO;
import com.ergou.easylive.admin.entity.dto.SysUserRegisterDTO;
import com.ergou.easylive.admin.service.SysUserService;
import com.ergou.easylive.common.entity.response.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 系统用户(SysUser)控制层
 *
 * @author Er-Gou
 * @date 2025-09-22 20:15
 */
@RestController
@RequestMapping("/sysUser")
@Tag(name = "系统管理", description = "系统用户管理、权限管理等系统管理相关接口")
public class SysUserController {

    @Resource
    private SysUserService sysUserService;

    @PostMapping("/register")
    @Operation(summary = "用户注册", description = "用户通过用户名和密码进行注册")
    public Result register(@RequestBody SysUserRegisterDTO sysUserDTO) {
        SysUserRegisterBO sysUserRegisterBO = SysUserRegisterDTOConverter.INSTANCE.convertDTOToBO(sysUserDTO);
        sysUserService.register(sysUserRegisterBO);
        return Result.success();
    }
}
